import {request} from "@@/exports";
import {ResponseStructure} from "@/requestErrorConfig";

export async function pageRegion(
  params: {
    current?: number;
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<ResponseStructure>('/api/region/page', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

export async function updateRegionById(region: API.IRegion, options?: DynamicObject,) {
  return request<ResponseStructure>('/api/region/updateById', {
    method: 'put',
    data: region,
    ...(options || {}),
  });
}
export async function deleteRegion(id: string | number, options?: DynamicObject) {
  return request<ResponseStructure>(`/api/region/${id}`, {
    method: 'DELETE',
    ...(options || {}),
  });
}

export async function addRegion(region: API.IRegion, options?: DynamicObject,) {
  return request<ResponseStructure>('/api/region', {
    method: 'POST',
    data: region,
    ...(options || {}),
  });
}
